
var Playback = {
	template: '<iframe frameborder="0" width="600" height="400" v-if="show" class="playback" src="/Playback/iframe.html"></iframe>',
	props : {
	  url: {
	  	type: String,
		  default : ""
	  },
		token:{
	  	type : String,
			default : ""
		}
	},
	data:function() {
		return {
	    show : false
		}
	},
	mounted : function() {
		var _this = this;
		this.$watch(function() {
	    return _this.url && _this.token
		},function (newVal) {
			if(newVal){
				_this.start();
			}
		},{
			immediate: true
		});
	},
	methods : {
    init:function(){
	    var _this = this;
	    this.windowIframe = this.$el.contentWindow;
	    this.windowIframe.addEventListener('load',function (ev) {
		    _this.windowIframe.init(_this.url,_this.token)
	    })
    },
		viewBack:function(url){
			this.windowIframe.init(url,this.token)
		},
		start : function() {
			var _this = this;
			this.show = true;
			this.$nextTick(function() {
				_this.init();
			})
		},
		destroy :function() {
			this.show = false;
		}
	}
};
